package logger

import "go.uber.org/zap/zapcore"
import "fmt"

// LoggerSettingS ...
type LoggerSettingS struct {
	LogLevel zapcore.Level `json:"log_level"`

	OutFile    bool   `json:"out_file"`
	FilePath   string `json:"file_path"`
	MaxSize    int    `json:"max_size"`
	MaxBackups int    `json:"max_backups"`
	MaxAge     int    `json:"max_age"`

	OutConsole bool `json:"out_console"`

	OutChannel        bool   `json:"out_channel"`
	ChannelEncodeType string `json:"channel_encode_type"`
	ChannelBufferLen  int    `json:"channel_buffer_len"`
}

// String ...
func (s *LoggerSettingS) String() string {
	str := "\n"

	str += fmt.Sprintln("----日志模块配置-----")
	str += fmt.Sprintln("文件输出：", s.OutFile)
	if s.OutFile {
		str += fmt.Sprintln("文件路径：" + s.FilePath)
		str += fmt.Sprintln("单文件大小：", s.MaxSize, "MB")
		str += fmt.Sprintln("备份个数：", s.MaxBackups)
		str += fmt.Sprintln("文件保留天数：", s.MaxAge, "天")
	}

	str += fmt.Sprintln("----------")
	str += fmt.Sprintln("命令行输出:", s.OutConsole)

	str += fmt.Sprintln("----------")
	str += fmt.Sprintln("通道输出:", s.OutChannel)
	if s.OutChannel {
		str += fmt.Sprintln("通道输出类型:", s.ChannelEncodeType)
		str += fmt.Sprintln("通道缓冲长度:", s.ChannelBufferLen)
	}
	str += fmt.Sprintln("----------")

	return str
}
